#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

int main()
{
  pid_t pid;
  int i = 0;
  int stast = 10;
  pid=fork();
  if(pid>0)
  {
    printf("The father process id running ! fatherpid=%d \n",getpid());
  }
  if(pid==0)
  {
    while(1)
    {
      //打印子进程进程号信息。
      printf("The child  process is running ! childpid=%d fatherpid=%d \n",getpid(),getppid());
      sleep(2);
      i++;
      if(i==5)
      {
        //当子进程运行5 次就退出
        printf("The child process will be exit !\n");
        exit(0);//**
      }
    }
  }
    return 0;
}

